Stack Underflow error for DXL Script in batch mode

Hi,

If i run the attached script via DXL editor it works perfectly fine. But when i run the script via batch mode to automate the same, it gives me Stack Underflow error.

Can anyone help me with the same?

 

Here is the DXL File being called by the batch:

 

 // ###########CODE ##############
const string GWSLogfilepath=getenv("myLOGS_GWS")
string GWSLogfilename=GWSLogfilepath

 DB theDiag = null

// Now override block and show, to only do realize
void show  (DB x) { realize x; theDiag = x }
void block (DB x) { realize x; theDiag = x }


void fWriteErrorToFile(string sErrorStr,string sParameters)    {             //Writing into the log file if the parameter passed is string
    Stream out = write GWSLogfilename
string Time = dateAndTime (today)""

    out << sErrorStr "\n"
    out << sParameters "\n"
    out << Time "\n"
    close out
}
 
if (null current Module)
{
    print "You need to have a current Module set for executing the tool."
    fWriteErrorToFile("You need to have a current Module set for executing the tool.","")
        halt
}

// we need braces, since -D will be executed at top level and we will get name
// clashes for variable defined in word.dxl and the other includes of it.
{
        
#include <U:\\Connect\\connectivityTool.dxl>


   findChanges theDiag
        // get rid of the dialog
        if (!null theDiag) destroy theDiag  

}

fWriteErrorToFile("\n Execution of GWS completed","End Time:")
save(current Module)
close(current Module)
exit_


Gsquare - Fri Oct 26 04:54:21 EDT 2018

Re: Stack Underflow error for DXL Script in batch mode
Mike.Scharnow - Fri Oct 26 06:03:41 EDT 2018

There is no GUI and therefore no dialogs in Batch mode. You could try working with the -dxl switch instead. Or rewrite the script so that it does not use any GUI elements.

 

See e.g. https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014794906 for some hints

Re: Stack Underflow error for DXL Script in batch mode
Gsquare - Sat Oct 27 05:00:07 EDT 2018

Hello Mike,

 

This is the bat file that i am using to call the Code.dxl file. So you mean in this i replace -d with -dxl? i did not understand what you meant, could you help me little bit more here?

I do not have any experience when it comes to making DXLs run via batch.

 

// In this below code, the InvokeUIGWS.dxl is the dxl code that was part of my question above, not the attached file.

 

echo "STARTING"
@DATE /T
@TIME /T

@echo off                                                                        

set DOORS_MODULE=/TestArea/single
set myLOGS_GWS= U:\\Connect\\Connect.txt
                                                                        

"C:\Telelogic\DOORS_93\bin\doors.exe"  -D "current = read(\"%DOORS_MODULE%\", true); #include <U:\\Connect\\InvokeUIGWS.dxl>"

ECHO "FINISHING"

Re: Stack Underflow error for DXL Script in batch mode
Mike.Scharnow - Sat Oct 27 06:35:34 EDT 2018

Gsquare - Sat Oct 27 05:00:07 EDT 2018

Hello Mike,

 

This is the bat file that i am using to call the Code.dxl file. So you mean in this i replace -d with -dxl? i did not understand what you meant, could you help me little bit more here?

I do not have any experience when it comes to making DXLs run via batch.

 

// In this below code, the InvokeUIGWS.dxl is the dxl code that was part of my question above, not the attached file.

 

echo "STARTING"
@DATE /T
@TIME /T

@echo off                                                                        

set DOORS_MODULE=/TestArea/single
set myLOGS_GWS= U:\\Connect\\Connect.txt
                                                                        

"C:\Telelogic\DOORS_93\bin\doors.exe"  -D "current = read(\"%DOORS_MODULE%\", true); #include <U:\\Connect\\InvokeUIGWS.dxl>"

ECHO "FINISHING"

The parameters are explained here https://www.ibm.com/support/knowledgecenter/en/SSYQBZ_9.6.1/com.ibm.doors.configuring.doc/topics/c_clientcommandswitches.html  (which also explains some of the things not available in batch mode) and in the above linked posts.

But if you use "-D" you are already  in the interactive mode, not in batch mode. Batch mode would have been started with the "-b" parameter.

So, the error you get is not related to batch mode, there must be another cause.

 

Your code is qutie complex and there are several incudes, so it is not easy to find a problem just looking at the code.

You should provide more information where exactly the problem occurs and have a look what your code does in this particular moment.. Perhaps this post helps https://www.ibm.com/developerworks/community/forums/html/topic?id=1c9e6710-3160-4fb9-8391-a53d22f58bf0

Re: Stack Underflow error for DXL Script in batch mode
Gsquare - Mon Nov 05 03:43:30 EST 2018

Mike.Scharnow - Sat Oct 27 06:35:34 EDT 2018

The parameters are explained here https://www.ibm.com/support/knowledgecenter/en/SSYQBZ_9.6.1/com.ibm.doors.configuring.doc/topics/c_clientcommandswitches.html  (which also explains some of the things not available in batch mode) and in the above linked posts.

But if you use "-D" you are already  in the interactive mode, not in batch mode. Batch mode would have been started with the "-b" parameter.

So, the error you get is not related to batch mode, there must be another cause.

 

Your code is qutie complex and there are several incudes, so it is not easy to find a problem just looking at the code.

You should provide more information where exactly the problem occurs and have a look what your code does in this particular moment.. Perhaps this post helps https://www.ibm.com/developerworks/community/forums/html/topic?id=1c9e6710-3160-4fb9-8391-a53d22f58bf0

Okay, thanks for the hint, i will try to check the codes and links

Re: Stack Underflow error for DXL Script in batch mode
Mathias Mamsch - Mon Nov 05 03:47:53 EST 2018

Gsquare - Mon Nov 05 03:43:30 EST 2018

Okay, thanks for the hint, i will try to check the codes and links

Do not forget to try the "old trick" to simply wrap the whole script in "{ ... }" ... DOORS always had problems with scripts running on Top Level DXL. Putting "{ }"  around your script will create another stack level and might prevent the underflow. So it does not necessarily be a bug in your script. Regards, Mathias

Re: Stack Underflow error for DXL Script in batch mode
Gsquare - Wed Nov 07 00:59:19 EST 2018

Mathias Mamsch - Mon Nov 05 03:47:53 EST 2018

Do not forget to try the "old trick" to simply wrap the whole script in "{ ... }" ... DOORS always had problems with scripts running on Top Level DXL. Putting "{ }"  around your script will create another stack level and might prevent the underflow. So it does not necessarily be a bug in your script. Regards, Mathias

Hello Matthias,

 

The dxl script which my bat file calls already has a { }.. around the code after the #include part, which calls the dxl script functions.: Do you suggest to add a { } for the entire script?

 

const string GWSLogfilepath=getenv("myLOGS_GWS")
string GWSLogfilename=GWSLogfilepath

 DB theDiag = null

// Now override block and show, to only do realize
void show  (DB x) { realize x; theDiag = x }
void block (DB x) { realize x; theDiag = x }


void fWriteErrorToFile(string sErrorStr,string sParameters)    {             //Writing into the log file if the parameter passed is string
    Stream out = write GWSLogfilename
string Time = dateAndTime (today)""

    out << sErrorStr "\n"
    out << sParameters "\n"
    out << Time "\n"
    close out
}
 
if (null current Module)
{
    print "You need to have a current Module set for executing the tool."
    fWriteErrorToFile("You need to have a current Module set for executing the tool.","")
        halt
}

// we need braces, since -D will be executed at top level and we will get name
// clashes for variable defined in word.dxl and the other includes of it.
{
        
#include <U:\\Connect\\connectivityTool.dxl>


   findChanges theDiag
        // get rid of the dialog
        if (!null theDiag) destroy theDiag  

}

fWriteErrorToFile("\n Execution of GWS completed","End Time:")
save(current Module)
close(current Module)
exit_

Re: Stack Underflow error for DXL Script in batch mode
Mathias Mamsch - Wed Nov 07 03:58:48 EST 2018

Gsquare - Wed Nov 07 00:59:19 EST 2018

Hello Matthias,

 

The dxl script which my bat file calls already has a { }.. around the code after the #include part, which calls the dxl script functions.: Do you suggest to add a { } for the entire script?

 

const string GWSLogfilepath=getenv("myLOGS_GWS")
string GWSLogfilename=GWSLogfilepath

 DB theDiag = null

// Now override block and show, to only do realize
void show  (DB x) { realize x; theDiag = x }
void block (DB x) { realize x; theDiag = x }


void fWriteErrorToFile(string sErrorStr,string sParameters)    {             //Writing into the log file if the parameter passed is string
    Stream out = write GWSLogfilename
string Time = dateAndTime (today)""

    out << sErrorStr "\n"
    out << sParameters "\n"
    out << Time "\n"
    close out
}
 
if (null current Module)
{
    print "You need to have a current Module set for executing the tool."
    fWriteErrorToFile("You need to have a current Module set for executing the tool.","")
        halt
}

// we need braces, since -D will be executed at top level and we will get name
// clashes for variable defined in word.dxl and the other includes of it.
{
        
#include <U:\\Connect\\connectivityTool.dxl>


   findChanges theDiag
        // get rid of the dialog
        if (!null theDiag) destroy theDiag  

}

fWriteErrorToFile("\n Execution of GWS completed","End Time:")
save(current Module)
close(current Module)
exit_

Yes ... around the whole script ... Its worth a try ;-)

Re: Stack Underflow error for DXL Script in batch mode
Gsquare - Thu Nov 15 05:17:41 EST 2018

Mathias Mamsch - Wed Nov 07 03:58:48 EST 2018

Yes ... around the whole script ... Its worth a try ;-)

Thanks Mathias,

 

This definitely solved the problem.